package test.enba.mysql.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import org.springframework.stereotype.Service;
import test.enba.mysql.entity.User;
import test.enba.mysql.mapper.UserMapper;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

  // 使用主库
  @DS("master")
  public List<User> getMasterUsers() {
    return baseMapper.selectList(null);
  }

  // 使用从库
  @DS("slave")
  public List<User> getSlaveUsers() {
    return baseMapper.selectList(null);
  }
}
